!function() {
	
	// 获得基础JIPIN对象
	var JIPIN = window.__NS__JIPIN;
	if(!JIPIN) { return; }
	var $ = JIPIN.$;
	
	JIPIN._fixImage = JIPIN.fixImage;
	JIPIN._refixImage = JIPIN.refixImage;
	
	JIPIN._getSitePicDesc = JIPIN.getSitePicDesc;
	JIPIN.getSitePicDesc = function(targetPic) {
		if(isWaterfallPic(targetPic)) {
			var tweetContentClone = targetPic.closest('.i_w_f').children('.tweet_content').clone();
			tweetContentClone.children('span').remove();
			return ($.trim(tweetContentClone.text()) || targetPic.attr('title')) + ' ' + targetPic.parent().next('.p').text();
		} else {
			return JIPIN._getSitePicDesc(targetPic);
		}
	};
	
	JIPIN.getSourceURL = function(targetPic) {
		var url = document.location.href;
		if(isWaterfallPic(targetPic)) {
			url = targetPic.parent().get(0).href; 
		}
		return url;
	};
	
	JIPIN.fixImage = function(image, callback) {
		if(isWaterfallPic(image)) {
			callback(image);
		} else {
			this._fixImage(image, callback);
		}
	};
	
	JIPIN.refixImage = function(image, callback) {
		if(isWaterfallPic(image)) {
			callback(image);
		} else {
			this._refixImage(image, callback);
		}
	};
	
	function isWaterfallPic(pic) {
	    var parent = $(pic).parent().parent();
		return parent.is('li[type="goods"]') || parent.is('li[type="image"]');
	}
	
}();